In this notebook we model the movement of a Purcel swimmer with $\eta = 2$ and $\phi = \pi/3$ and visualise how this movement causes the velocity field of the liquid to change with time.
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
import seaborn as sns; sns.set(); sns.set_style("whitegrid")
plt.rcParams["animation.html"] = "jshtml"
from celluloid import Camera
import stokeslets as slts
import purcell as pur
figfile = "figs/"
et = 2
ph = np.pi/3
s,r,tim = pur.init(et,ph,T=16)
tau = pur.stroke_input(1.463,tim,r,strokes=2)
R = slts.mesher(np.arange(-1,1,0.1))
V,pswimmer = slts.evolve(tau,tim,R,r,s,k=100,e=0.3,c=0.6)
fig = plt.figure(figsize = (6,6))
ax = fig.gca(projection='3d')
camera = Camera(fig)
for i in range(0,np.shape(pswimmer)[0],50):
ax.plot(pswimmer[i].T[0],pswimmer[i].T[1],pswimmer[i].T[2],'k-', linewidth=2, label='_nolegend_')
ax.quiver(R[0], R[1], R[2], V[i,0], V[i,1], V[i,2],length=0.3, arrow_length_ratio=0.5)
ax.view_init(elev=50, azim=35)
ax.set_xlim([-1,1]); ax.set_ylim([-1,1]); ax.set_zlim([-1,1])
camera.snap()
plt.close()
animation = camera.animate()
animation.save(figfile+"purcell_swimmer_velocity.gif",writer = 'imagemagick',fps = 5,dpi=300)
animation